import 'package:flutter/material.dart';
import 'package:my_demo_flutter/my_base_lib/base_lib.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';

class PhotoViewTestPage extends StatefulWidget {
  static String routeName = "/PhotoViewTestPage";
  Map arguments;

  PhotoViewTestPage({Key? key,required this.arguments}) : super(key: key);

  @override
  _PhotoViewTestPageState createState() => _PhotoViewTestPageState();
}

class _PhotoViewTestPageState extends BaseWidgetState<PhotoViewTestPage> {
  List<String> images = [
    "assets/image/add.png",
    "assets/image/test.png",
    "assets/image/loading.png",
    "assets/image/ai_chat_sel.png",
    "assets/image/beginners_guide.png",
  ];

  late int x;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    x = widget.arguments["aaa"];
  }

  @override
  Widget build(BuildContext context) {
    LogUtils.e("aaa=$x");
    return Scaffold(
      backgroundColor: Colors.black,
      body: PhotoViewGallery.builder(
        itemCount: images.length,
        builder: (context, index) {
          return PhotoViewGalleryPageOptions(
              initialScale: PhotoViewComputedScale.contained * 0.8,
              heroAttributes:
                  PhotoViewHeroAttributes(tag: images[index]),
              imageProvider: AssetImage(images[index]));
        },
      ),
    );
  }
}
